home *** CD-ROM | disk | FTP | other *** search
/ Nautilus 1992 July / Nautilus-3-8 / Nautilus-3-8.bin / Tools & Utilities / Techy Stuff / Doco ƒ / CSMP ƒ / CSMP-V1-069.TXT < prev    next >
Encoding:
Text File  |  1992-06-03  |  35.7 KB  |  900 lines

  1. C.S.M.P. Digest             Sat, 02 May 92       Volume 1 : Issue 69
  2.  
  3. Today's Topics:
  4.  
  5.     Confusion on WDID, DirID, Vref
  6.     MacHack '92 Announcement
  7.     Patching a trap for print jobs...
  8.  
  9.  
  10. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  11.  
  12. These digests are available (by using FTP, account anonymous, your email
  13. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  14. edu.  This is also the home of the comp.sys.mac.programmer Frequently Asked
  15. Questions list.  The last several issues of the digest are available from
  16. sumex-aim.stanford.edu as well.
  17.  
  18. These digests are also available via email.  Just send a note saying that you
  19. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  20. automatically receive each new digest as it is created.
  21.  
  22. The articles in these digests are taken directly from comp.sys.mac.programmer.
  23. They are not edited; all articles included in this digest are in their original
  24. posted form.  The only articles that are -not- included in these digests are
  25. those which didn't receive any replies (except those that give information
  26. rather than ask a question).  All replies to each article are concatenated
  27. onto the original article in the order in which they were received.  Article
  28. threads are not added to the digests until the last article added to the
  29. thread is at least one month old (this is to ensure that the thread is dead
  30. before adding it to the digests).
  31.  
  32. Send administrative mail to mkelly@cs.uoregon.edu.
  33.  
  34. -------------------------------------------------------
  35.  
  36. From: phil@phunt.MV.COM (Phil Hunt)
  37. Subject: Confusion on WDID, DirID, Vref
  38. Date: 31 Mar 92 20:37:51 GMT
  39. Organization: Howtek, Inc.
  40.  
  41. Hi,
  42.  
  43. I am having some trouble with the ID values for DirId, WDID, and vref
  44.  
  45.  
  46. I know, Stdfil dialog returns a vref that is really the WD (or Dir)ID of the
  47. directory  the file specified is located on.....Then, throughout my program,
  48. I use that returned value and the actual filename to get to my pref file
  49.  
  50. Well, now I want to be able to do my rpgoram in 'batch', meaning, running
  51. from a command file, so I changed my program to allow the user (or command
  52. file) to enter a 'FULLY QUALIFIED PATH/FILENAME'...The Open calls use this
  53. correctly, but I need to be able to get the same type of Dir (or WD) id that
  54. stdfil gave me...In other words, I want to find the File with a full pathname,
  55. get the ID of where the file is and just keep the ID and the filename
  56.  
  57. I used FSOPEN, it returned a 'access path ID'...I then ran that through GetvRef,
  58. but it returned (-3), which is my VOLUME reference, not the directory reference
  59.  
  60. How do I do this?  It must be something I am overlooking!
  61.  
  62. Phil
  63.  
  64. - ------------------------------------------------------------------------
  65. Phil Hunt                                                  (603)882-5200
  66. Howtek, Inc.                           "Wherever you go, there you are!"
  67.  
  68. Internet: phil@phunt.MV.COM         uucp: {decvax|harvard}!mv!phunt!phil
  69.  
  70. +++++++++++++++++++++++++++
  71.  
  72. From: jh4o+@andrew.cmu.edu (Jeffrey T. Hutzelman)
  73. Date: 1 Apr 92 00:38:34 GMT
  74. Organization: Sophomore, Electrical and Computer Engineering, Carnegie Mellon, Pittsburgh, PA
  75.  
  76.  
  77.  
  78. On 31-Mar-92 in Confusion on WDID, DirID,
  79. user Phil Hunt@phunt.MV.COM writes:
  80. >Hi,
  81. >I am having some trouble with the ID values for DirId, WDID, and vref
  82. >I know, Stdfil dialog returns a vref that is really the WD (or Dir)ID of the
  83. >directory  the file specified is located on.....Then, throughout my program,
  84. >I use that returned value and the actual filename to get to my pref file
  85. >Well, now I want to be able to do my rpgoram in 'batch', meaning, running
  86. >from a command file, so I changed my program to allow the user (or command
  87. >file) to enter a 'FULLY QUALIFIED PATH/FILENAME'...The Open calls use this
  88. >correctly, but I need to be able to get the same type of Dir (or WD) id that
  89. >stdfil gave me...In other words, I want to find the File with a full pathname,
  90. >get the ID of where the file is and just keep the ID and the filename
  91. >I used FSOPEN, it returned a 'access path ID'...I then ran that through
  92. GetvRef,
  93. >but it returned (-3), which is my VOLUME reference, not the directory
  94. reference
  95. >How do I do this?  It must be something I am overlooking!
  96. >Phil
  97.  
  98. Well, there are several things you can do, that I can think of:
  99.  
  100. What you seem to be asking for is a way to get a working directory
  101. reference number for the directory the file is in.  However, WD numbers
  102. are assigned dynamically as programs ask for them.  You can get one by
  103. calling PBOpenWD or its high-level equivalent, but it won't be the same
  104. the next time your program runs.
  105.  
  106. What you WANT is to get the vRefNum of the volume the file is on, AND
  107. the dirID of the directory the file is contained in.  These will
  108. uniquely identify the file forever, as long as that volume gets the same
  109. vRefNum the next time the machine starts up, which it normally will,
  110. unless removable volumes or fileservers are involved, in which case all
  111. bets are off.  You can get the vRefNum, dirID, and filename by calling
  112. PBGetCatInfo on the full pathname.
  113.  
  114. The best way to keep track of such a file would be to store either the
  115. full pathname (calling PBGetCatInfo when you read the name to get
  116. vRefNum and dirID, if you really need them), or store the volume name,
  117. dirID, and filename.  Of course, this still fails if there are 2 volumes
  118. with the same name.
  119.  
  120. Finally, if you are willing to be System 7 dependant, you can use the
  121. alias manager to create an alias record for the file, and then use it to
  122. resolve the alias when you want to get at the file.  I believe resolving
  123. an alias record results in an FSSpec, which can be trivially converted
  124. into a vRefNum, dirID, and filename.
  125.  
  126. - -- Jeffrey Hutzelman
  127.  
  128. jh4o+@andrew.cmu.edu, jhutz@drycas.BITNET
  129. JeffreyH11 on America Online
  130.  
  131. ---------------------------
  132.  
  133. From: waldemar@toast.ai.mit.edu (Waldemar Horwat)
  134. Subject: MacHack '92 Announcement
  135. Date: 31 Mar 92 23:50:19 GMT
  136.  
  137.  
  138. MacHack '92 - The Seventh Annual Macintosh Technical Conference
  139. June 17 - 19, 1992
  140. Ann Arbor, Michigan
  141.  
  142. For the seventh year, MacHack(tm) provides a forum specifically for software
  143. developers for the Macintosh(r) family of computers. The conference provides
  144. developers a full spectrum of information about hardware, developers' software,
  145. and support at a high level of complexity and application.
  146.  
  147. The conference includes:
  148.   Panels
  149.   Papers
  150.   Roundtables
  151.   Code Clinics
  152.   24-Hour Machine Room
  153.   Business Sessions
  154.   Vendor Showcases
  155.   Lots of opportunities to meet Apple engineers and other Mac software
  156.     developers
  157.  
  158.  
  159. Panels
  160.  
  161. These panel sessions constitute the core of the conference. Ranging over a wide
  162. variety of topics, the panels address areas of current interest to Macintosh
  163. programmers.  Some of the topics are listed below:
  164.  
  165. MacHack 101
  166. This session is a light hearted introduction to MacHack, its customs, and
  167. expectations. It will introduce the first time MacHacker to how things work and
  168. where to find them, and give the seasoned veteran a look at the new features
  169. and scheduling.
  170.  
  171. Essence of the Hack
  172. The raison d'etre of MacHack is the hack. Discover the essential elements of
  173. creating a hack: hooking in, laying low, following the rules.
  174.  
  175. Graphics
  176. This session will focus on new graphics support coming from Apple. If you are
  177. at all interested in graphics, or even if you are not, this is probably a
  178. session you will want to attend!
  179.  
  180. Networking
  181. No computer is an island. From the basic one Macintosh and a printer to the
  182. largest corporations and universities, networks are the basis of communications
  183. between computers. With publish and subscribe an integral part of the
  184. operating system, it is becoming more and more essential to have your work
  185. network compatible. Learn networking secrets here.
  186.  
  187. RISC
  188. Find out the low-down about Apple's new RISC development and what it means to
  189. developers. Are you going to have to rewrite all your apps from scratch?
  190.  
  191. Coming Attractions in System Software
  192. Get the inside scoop on new things planned for system software, from the people
  193. actually doing them.
  194.  
  195. Stump the Panel
  196. Bring your toughest questions for this panel of Gurus, and other know-it-alls!
  197. No holds barred. Try to stump them! (The panel is armed with all its
  198. knowledge!) Special prizes for stumping the panel.
  199.  
  200. QuickTime(tm)
  201. An in-depth look at the QuickTime software architecture, its uses and
  202. ramifications. Find out how you can use QuickTime in your applications, and
  203. what you need to do to make it work.
  204.  
  205. Future of MPW
  206. Is MPW an Edsel, doomed to extinction, a Volkswagen with a future in
  207. collectibles, or Corvette ZR1 on the cutting edge and getting better? Where is
  208. MPW going? What sort of things can you expect from Apple's development system
  209. in the future?
  210.  
  211. Poor Man's OOP
  212. A personal encounter with object oriented programming. One man's experience
  213. with Smalltalk and an introduction for you.
  214.  
  215. Graphics Acceleration
  216. It used to be simple. Black & white, 72dpi, 9 inch screen and one interface.
  217. Not so anymore. With color the new standard and several new ways of getting
  218. images on-screen, even the new built-in graphics devices can't keep up. Get the
  219. scoop on graphics acceleration here.
  220.  
  221. Hyperzealot!
  222. Hear about hypercard, its past, present and future.... and see some nifty keen
  223. demos of quicktime and color in hypercard from one of the senior engineers on
  224. the hypercard project.
  225.  
  226. Translation XTND and Beyond
  227. Why has Apple been encouraging you to write XTND translators for your document
  228. formats? Is there life beyone XTND? Come talk to someone who knows.
  229.  
  230. Innards of the File System
  231. The current King of HFS will walk thru the internals of the file system,
  232. explaining every last secret of the file system. Well, maybe not all of them...
  233.  
  234. Collaborative Computing
  235. Find out what Apple's Collaborative computing is all about. Why all the hoopla
  236. anyway?
  237.  
  238. Apple Feedback
  239. Here is your chance to send information back to Apple, about what they are
  240. doing wrong, and more importantly, what they are doing right! Bring your
  241. questions and comments to Apple's cast of tens. Find out from the perpetrators
  242. why certain decisions were made and let your feelings about Apple's policies be
  243. known where it counts.
  244.  
  245.  
  246. Papers
  247.  
  248. Ten academic papers will be presented on programming at the cutting edge. The
  249. text of the papers will be distributed to all conference attendees.
  250.  
  251. The Construction of a TCP/IP to AppleEvent Gateway for Use in Distributed
  252. Computing Experimentation
  253.    Christopher Haupt    RIT/SCI
  254.  
  255. Object-PatchWorks
  256.    Patrick Beard        Berkeley Systems
  257.  
  258. Optimizing Source Code
  259.    Shane Looker
  260.  
  261. Experiences from the Development of Harvest C
  262.    Eric Sink            USACERL
  263.  
  264. Putting an Object-Oriented Face on a Toolbox Manager: How to use OOP to manage
  265. toolbox complexity
  266.    Ralph Krug
  267.  
  268. Passing the Torch: Enabling the next generation of hackers
  269.    Tom Pittman
  270.  
  271. Macintosh Common Lisp
  272.    Mike Engber
  273.  
  274. Cognits: A portable library of intelligent classes
  275.    Dr. Steven Lewis     The Aerospace Corp
  276.  
  277. Euclid: Collaborative reasoning with hypertext
  278.    Bernie Bernstein
  279.  
  280. Macintosh and Microsoft Windows 3.0: A developer's perspective
  281.    Waldemar Horwat
  282.  
  283.  
  284. Roundtables
  285.  
  286. Roundtable sessions will consist of a moderator, attendees, a Macintosh, and a
  287. dedicated area. Session topics are as specific or as general as desired. Topics
  288. are scheduled either dynamically or in advance; if there is a specific topic
  289. you wish to see discussed, call Expotech to arrange for a roundtable time.
  290. Moderators of roundtables that are scheduled before May 1st may be eligible
  291. for the speaker discount.
  292.  
  293.  
  294. Code Clinics
  295.  
  296. In addition to the regularly scheduled sessions, there will be "Code Clinics"
  297. where some of the most talented code-hackers attending actually dissect, debug,
  298. and comment on code. Real, hands-on sessions up close and personal with that
  299. code. Sessions include:
  300.    Color Quickdraw
  301.    File System - HFS
  302.    AppleTalk Protocols
  303.    Memory Management
  304.    AppleEvents
  305.    International Problems
  306.    System Extensions - INITs, drvrs etc.   System 7 coolness
  307.    Managing resources
  308.    Sound
  309.  
  310.  
  311. Machine Room
  312.  
  313. One of the most heavily used areas of MacHack every year is the "Machine Room",
  314. open 24 hours per day.  Using equipment donated by the University of Michigan,
  315. Apple Computer, and many other organizations, attendees are encouraged to
  316. program, collaborate, try out ideas, and design throughout the conference.
  317.  
  318.  
  319.  
  320. Business Sessions
  321.  
  322. A series of presentations on setting up, managing, financing, and protecting a
  323. software company. Note: class size is limited, and there is a small surcharge
  324. for attending business sessions.
  325.  
  326. Introduction to Suits and Weasels
  327. a review of basic business requirements, including a guide to telling the role
  328. of the person you are talking to by haircut and tie.
  329.  
  330. Business Plan Basics
  331. This is an overview of all the parts of a business plan and what needs to go
  332. into them. Not only for a Vulture capitalist or a bank, but so you can keep
  333. friends, friends and avoid lawsuits.
  334.  
  335. Marketing Plans
  336. An overview of the Macintosh market, how to determine market size and how to
  337. write a marketing plan that has meaning, outside the bathroom.
  338.  
  339. Mating Rituals 1 - Attracting a publisher
  340. This is the first session in how to get married and make money for both
  341. partners. You will learn the waltz in this session. Also tips on flirting with
  342. a publisher.
  343.  
  344. Mating Rituals 2 - What a publisher is looking for in an author
  345. What does the publisher want in an author and a product. Why redheads have more
  346. success at a party. What not to wear to the party.
  347.  
  348. The Family Feud
  349. Now that they are married these publisher/author combinations discuss the
  350. intimate facts of their marriages and why they are still together.
  351.  
  352. Getting 5 Mice (5 stars) - Working with the press
  353. Here is a panel on how to get the press to like you and your product, care and
  354. feeding of your favorite editor and how to pick one.
  355.  
  356. Project terms
  357. A quick review of the lingo of Pert and Gantt. Or how to speak the language of
  358. projects without offending your host.
  359.  
  360. Software Project Planning
  361. We have MacApp and C++ but the basic rules still apply for determining how long
  362. and how hard you have to work to finish a project. This is a review of the
  363. basic rules to planning projects, so the cupboard does not run bare.
  364.  
  365. Project Management
  366. You can not finish all the software yourself, so sometimes, you need to get
  367. other people to help, how to manage that process and make the right calls for a
  368. project that is on track and one that left the track weeks ago.
  369.  
  370. The Basics of Software Contracts - Or - Why lawyers are like ICBMs
  371. `Nuff Said!
  372.  
  373. What You Need to Know About
  374. Patents, Copyrights, and Trademarks
  375.  
  376. Protecting the Crown Jewels -
  377. An introduction to trade secrets
  378. Shhhhh! We could tell you but then we would have to shoot you.
  379.  
  380. Bundling & Co-marketing
  381. How to leverage the market and get the combination packages together and sell
  382. them to the public without incuring major expense.
  383.  
  384. Getting Bucks -
  385. Surviving the venture capitalists
  386. and if you don't succeed how to live with Danny DeVito as your new boss.
  387.  
  388. Contract Programming
  389. How to make money with your fingers.
  390.  
  391. Work For Hire
  392. This is a review of what the term means and why you do not own your own code
  393. anymore.
  394.  
  395. Tech Writing Workshop
  396. If you like the manual, you will love the movie. A panel on how to make your
  397. manuals more witty and readable than this brochure from pros who do it all the
  398. time.
  399.  
  400. On-line Help Systems
  401. A look at why the manual may not be enough and what belongs in your help system
  402. for both system 6 and 7.
  403.  
  404. Business Plan Review
  405. A working Brunch for the first 6 people to sign up. It will run with
  406. interuptions all day Saturday until the party starts. Review the Business Plan
  407. that you wrote during your spare time since Wednesday morning.
  408.  
  409.  
  410. Vendor Showcase
  411.  
  412. Representatives of companies who are also conference attendees will be making
  413. scheduled presentations of products that are of interest to programmers.
  414.  
  415.  
  416. Important Details
  417.  
  418. MacHack '92 will consist of no more than 300 of the best programmers in the
  419. Macintosh world. In addition, we make every effort to keep prices reasonable.
  420. The costs to attend are:
  421.    Prior to 4/16/92 - $295.00
  422.    4/16/92 or after - $345.00
  423.    Full-time student-  $50.00 (no lunches or banquet)
  424. The fee includes admittance to the conference sessions, copies of the
  425. proceedings on disk and on paper, three lunches, one banquet, and breaks.
  426. It can, as usual, cost you even less. As an invited speaker at one or more of
  427. the sessions, the cost is only:
  428.    Speaker - prior to 4/16/92 - $195.00
  429.    Speaker - 4/16/92 or after - $245.00
  430.  
  431. Location
  432.  
  433. The conference will take place at the Ann Arbor Holiday Inn - West, 2900
  434. Jackson Road, Ann Arbor, MI 48103. Call 313-665-4444 for reservations.  Make
  435. sure the hotel knows you are with MacHack '92 to receive the special rate of
  436. $64/single-night or $74/double-night.
  437.  
  438. Speaking
  439.  
  440. It may still be possible to sign up to speak on some of the topics or moderate
  441. a roundtable (and thus qualify for a reduced fee). If you feel qualified and
  442. willing to speak on one of these topics, contact Aimee Moran at Expotech.
  443.  
  444. Registration
  445.  
  446. To request more information or to register, call Expotech at 313-882-1824.
  447.  
  448. +++++++++++++++++++++++++++
  449.  
  450. From: CXT105@psuvm.psu.edu (Christopher Huckabay Modeller Tate)
  451. Date: 1 Apr 92 02:54:19 GMT
  452. Organization: Penn State University
  453.  
  454. Would it be possible for someone (or perhaps sometwo or -three) to
  455. summarize a few of the juicy details that come out of MacHack to
  456. the net?
  457.  
  458. For example, I'd love to hear what they have to say on RISC, on the
  459. new graphics support, and on graphics acceleration, but I've got the
  460. proverbial snowball's chance in Pittsburgh of actually making it to
  461. the conference....
  462.  
  463. - -------
  464. Christopher Tate     | Cryptogram #11:
  465. cxt105@psuvm.psu.edu |
  466. CXT105@PSUVM.BITNET  | "KOI SDXG EDKZZ QXKS SDXMN EAHNIE MOSH CZHAEDKNXE,
  467. - ---------------------|  YHN MY GHV DMS K BKO AMSD K CZHAEDKNX, DX'E UHMOU
  468. Send me the answer!  |  SH TOHA DX'E QXXO DMS."   (QNVFX DHVZS)
  469.  
  470. ---------------------------
  471.  
  472. From: blimoges@sobeco.com (Bertrand Limoges)
  473. Subject: Patching a trap for print jobs...
  474. Date: 28 Feb 92 21:58:54 GMT
  475. Organization: Sobeco Ernst & Young Inc.
  476.  
  477. Hi,
  478.  
  479. I need a dialog to come up every time someone prints from an application.
  480. This has to work with any application so I can only think of an INIT to
  481. do the work. However I don't really want to patch _PrGlue (0xA8FD) if I
  482. can avoid it, since it gets called several times during the printing
  483. process (and even to set up default printing record when apps start up)
  484. and I would have to check the stack for the value that says PrOpenDoc,
  485. for example.
  486.  
  487. So, does anyone have any alternate suggestions? If not, could I get a
  488. few tips on restoring the stack before jmp'ing to the original trap
  489. address once my code is done. I'm using THINK C, and when I patch for
  490. PrOpenDoc I have to check if the parameter is 0x0400 0x0C00 and if not
  491. I attempt to move the value back on the stack and jmp to the original
  492. address, but I can't seem to succeed. If there is no alternative, I'll
  493. post some code I tried for more specific info.
  494.  
  495. Thanks, Bertrand
  496.  
  497.  
  498.  
  499. - -------------------------
  500.  
  501. From: Pete.Gontier@p811.f70.n109.z1.fidonet.org (Pete Gontier)
  502. Date: Mon, 02 Mar 1992 21:05:43 -0500
  503.  
  504.  BL> From: blimoges@sobeco.com (Bertrand Limoges)
  505.  
  506.  BL> I need a dialog to come up every time someone prints from an application.
  507.  BL> This has to work with any application so I can only think of an INIT to
  508.  BL> do the work. However I don't really want to patch _PrGlue (0xA8FD) if I
  509.  BL> can avoid it, since it gets called several times during the printing
  510.  BL> process (and even to set up default printing record when apps start up)
  511.  BL> and I would have to check the stack for the value that says PrOpenDoc,
  512.  BL> for example.
  513.  
  514.  BL> So, does anyone have any alternate suggestions? If not, could I get a
  515.  BL> few tips on restoring the stack before jmp'ing to the original trap
  516.  BL> address once my code is done...
  517.  
  518. Go ahead and patch the bastard. It's not so awful.
  519.  
  520. I haven't looked at this code in a while -- I remember it worked as of some
  521. time late last year, under both System 7 and System 6.
  522.  
  523. Have fun. Four spaces to the tab, BTW.
  524.  
  525. /**************************************************************************/
  526.  
  527. static Boolean PasswordDialog(void) {
  528.     Rect boundsRect;
  529.     unsigned char *ditlS = "\p000300000000003600D0004A010A04024F4B0000000000360086004A00C0040643616E63656C000000000012000B00220056880950617373776F72643A0000000000001200590022010A9000";
  530.     short itemHit; DialogPtr passD;
  531.     Handle ditl = NewHandle((*ditlS / 2) + 1);
  532.  
  533.     if (!ditl) return(false);
  534.     StuffHex(*ditl,ditlS); SetRect(&boundsRect,40,40,350,150);
  535.     passD = NewDialog(nil,&boundsRect,"\p",true,dBoxProc,(WindowPtr) -1,false,0,ditl);
  536.     if (!passD) { DisposeHandle(ditl); return(false); }
  537.     InitCursor( );
  538.     do {
  539.         ModalDialog(nil,&itemHit);
  540.     } while (itemHit != OK && itemHit != Cancel);
  541.     DisposeDialog(passD);
  542. }
  543.  
  544. static void * PrJobDialogPatch(void *pOldAddress) {
  545.     asm {
  546.             LEA            @jmpOld,A0
  547.             ADDQ.L        #2,A0
  548.             MOVE.L        pOldAddress,(A0)
  549.             LEA            @patch,A0
  550.             MOVE.L        A0,D0
  551.             BRA.S        @out
  552. @patch:        CMPI.L        #0x32040488,4(A7)        ; check for PrJobDialog
  553.             BEQ.S        @go
  554.             CMPI.L        #0x4A040894,4(A7)        ; check for PrDlgMain
  555.             BNE.S        @jmpOld
  556. @go            JSR            PasswordDialog
  557. @jmpOld:    JMP            'PrGl'
  558. @out:
  559.     }
  560. }
  561.  
  562. /***********************************************************************/
  563.  
  564. #define kTrapNumberMask            0x07FF
  565. #define kUnimplementedTrapWord    0xA89F
  566.  
  567. static void * AS_GetTrapAddress (short trapWord) {
  568.     return ((void *) NGetTrapAddress (trapWord & kTrapNumberMask, (trapWord & 0x0800) ? ToolTrap : OSTrap));
  569. }
  570.  
  571. static void AS_SetTrapAddress (void *proc, short trapWord) {
  572.     NSetTrapAddress ((long) StripAddress(proc), trapWord & kTrapNumberMask, (trapWord & 0x0800) ? ToolTrap : OSTrap);
  573. }
  574.  
  575. #define _PrGlue 0xA8FD
  576.  
  577. void main(void) {
  578.     void *me; asm { MOVE.L A0,me }
  579.     DetachResource(RecoverHandle(me));
  580.     AS_SetTrapAddress(PrJobDialogPatch(AS_GetTrapAddress(_PrGlue)),_PrGlue);
  581. }
  582.  
  583. +++++++++++++++++++++++++++
  584.  
  585. From: dowdy@apple.com (Tom Dowdy)
  586. Date: 8 Mar 92 18:03:17 GMT
  587. Organization: Apple Computer, Inc.
  588.  
  589. In article <1992Feb28.215854.2568@sobeco.com>, blimoges@sobeco.com (Bertrand Limoges) writes: 
  590. > I need a dialog to come up every time someone prints from an application.
  591. > This has to work with any application so I can only think of an INIT to
  592. > do the work. However I don't really want to patch _PrGlue (0xA8FD) if I
  593. > can avoid it, since it gets called several times during the printing
  594. > process (and even to set up default printing record when apps start up)
  595. > and I would have to check the stack for the value that says PrOpenDoc,
  596. > for example.
  597.  
  598. I hate to rain on your parade here - but patching PrGlue alone won't
  599. do it.  The reason is kind of complexicated, but if you are willing
  600. for a story, here goes:  (I'm sure someone like Dave will jump in
  601. and correct any historical inaccuracies.  I'm just a "new" oldtimer here, 
  602. coming up on my first 5 years)
  603.  
  604. Back in the good old days, there was no printing trap.  In fact,
  605. there were no printer drivers either (at least, not in the sense
  606. that we know them today).  Instead there was a low level 'DRVR' that
  607. was called with the correct set of parameters to make requests.
  608. Rather than having to remember all of those icky paramBlocks, some
  609. folks thought of writing some glue code as well to make it easier
  610. for programmers.
  611.  
  612. Later in the Mac development game, the idea that these low level
  613. drivers probably weren't enough came up.  Thus was born the
  614. high level printing manager interface that we all know and hate
  615. today.  However (I suspect) it was too late in the Mac development
  616. cycle to add another trap (and/or the ROMs were full), so PrGlue
  617. was really just a set of libraries that basically ended up doing an
  618. OpenResFile, GetResource, HLock, JMP on the various PDEFs. This all
  619. probably made sense at the time, because they already had this handy
  620. library called PrGlue to stuff things into.
  621.  
  622. Aside: rumor has it that the _PrGlue trap had actually been allocated
  623. for the Print Manager as early as 1982 or 83, but for some other
  624. reason wasn't included in the ROM.  I once again claim a combination
  625. of space and/or timing. 
  626.  
  627. And then the Mac was released, and apps started to be written.
  628. Every app linked with PrGlue, but some of them actually wrote their
  629. own and linked with THAT - after all, it's just library code.
  630. Microsoft was particularlly a big fan of redoing
  631. the glue to conform to their own idea of how things should be done.
  632. If you ever want to hear a big rant, just ask a PrintShop person about
  633. "the Seattle font".
  634.  
  635. When the Plus was released, the allocated PrGlue trap was finally
  636. used, and the PrGlue library was changed to use the trap when it
  637. was implemented (or to continue to call the old way if it was not).
  638. In theory, this would solve the problem because now there was a trap
  639. available - thus allowing patching once all of the applications were
  640. converted over.
  641.  
  642. Unfortunatly for our hero (or anyone wanting to change how the printing
  643. manager works) there were already zillions (or thousands) of applications
  644. out there that were linked with a PrGlue library that did NOT use the
  645. trap.  I venture to guess that a decent percentage of new versions of
  646. applications today still are using the old-style glue in some way (sometimes
  647. they'll use old style glue for some calls, and the trap for others - Whee!)
  648.  
  649. When 7.0 came out, we had to do some pretty evil patching to move the
  650. printer drivers into the exentions folder, because of all of these
  651. apps (and glue) out there that were assuming they could just OpenResFile
  652. to get at the driver.  (And when I say "we" here, I mean somebody
  653. other than me).  I don't really want to go into the specifics here because:
  654.  a) I don't know what they all are, and am loath to give a half answer
  655.  
  656.  b) it's very complex, and not something Joe Average INIT writer should
  657.     try to tackle (especially if he's scared to even patch PrGlue).
  658.  
  659.  c) it's not gonna work in the future.
  660.  
  661. This all doesn't even get into the fact that there are actually multiple
  662. versions of the glue out there, and also that lots of apps call the
  663. printing manager incorrectly, so you have to watch for things like
  664. PrValidate before a call to PrOpen, or a call to PrClose without a call
  665. to PrOpen.  Or two calls to PrClose (*really* close the Printing Manager).  
  666. Oh, and don't forget the ever popular "forgetting to call PrClose 
  667. at all" - it's a BIG hit.
  668.  
  669. Here endeth the lesson - oh yeah, I *am* in the PrintShop - where a sense
  670. of humor is your only defense from sticking yourself with a knife.
  671.  
  672.  Tom Dowdy                 Internet:  dowdy@apple.COM
  673.  Apple Computer MS:81KS    UUCP:      {sun,voder,amdahl,decwrl}!apple!dowdy
  674.  20525 Mariani Ave         AppleLink: DOWDY1
  675.  Cupertino, CA 95014       
  676.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  677.  
  678. +++++++++++++++++++++++++++
  679.  
  680. From: casseres@apple.com (David Casseres)
  681. Date: 9 Mar 92 18:33:41 GMT
  682. Organization: Apple Computer Inc.
  683.  
  684. In article <21241@goofy.Apple.COM>, dowdy@apple.com (Tom Dowdy) writes:
  685.  
  686. [A lengthy and helpful explanation of why it won't do to just patch the printing
  687. trap, including the following]
  688.  
  689. > I hate to rain on your parade here - but patching PrGlue alone won't
  690. > do it.  The reason is kind of complexicated, but if you are willing
  691. > for a story, here goes:  (I'm sure someone like Dave will jump in
  692. > and correct any historical inaccuracies.  I'm just a "new" oldtimer here, 
  693. > coming up on my first 5 years)
  694. > Back in the good old days, there was no printing trap.  In fact,
  695. > there were no printer drivers either (at least, not in the sense
  696. > that we know them today).  Instead there was a low level 'DRVR' that
  697. > was called with the correct set of parameters to make requests.
  698. > Rather than having to remember all of those icky paramBlocks, some
  699. > folks thought of writing some glue code as well to make it easier
  700. > for programmers.
  701. > Later in the Mac development game, the idea that these low level
  702. > drivers probably weren't enough came up.  Thus was born the
  703. > high level printing manager interface that we all know and hate
  704. > today....
  705.  
  706. This is the only historical inaccuracy, so here comes the Historical Accuracy
  707. Police:
  708.  
  709. I'm pretty sure the high-level interface came first in the original design
  710. process, as it bore a fairly close resemblance to the one used in the Lisa.  At
  711. first release of the Mac, though, the whole amazing "architecture" of printing
  712. was in place, except for the trap and the Wonderful Chooser.  The only printer
  713. type was of course the ImageWriter, and we had both a low-level DRVR type driver
  714. implementing the low-level, ASCII-based interface and the high-level,
  715. raster-based interface.  The DRVR was called directly, and the high-level PDEF
  716. was called via the PrGlue library, which was shipped to developers as a linkable
  717. object.  The original reason for PrGlue was to do all the business of finding
  718. and loading up a PDEF code resource and jumping into the right entry point.
  719.  
  720. When the LaserWriter came along, the Wonderful Chooser was invented by a middle
  721. manager as the solution to having more than one kind of printer to talk to.  It
  722. meant that the application and the print code itself did not know what kind of
  723. printer to print on without going on a treasure hunt to find the information
  724. left by the Chooser.  So PrGlue had to be rev'ed so it would do that.  That's
  725. when we began to realize how bad it was to depend on a linkable library --
  726. applications couldn't do the right thing unless their developers relinked them
  727. and shipped out the revision.  Guess how popular that was!  That's why we
  728. finally got the trap implemented, so that applications could make generic calls
  729. to the trap and the system software behind the trap would do the right thing for
  730. the current printer.  Or implement any other revs we might dream up, without
  731. requiring app developers to do anything.
  732.  
  733. The original idea behind the separation of low-level and high-level printing
  734. interfaces was that on a 128K Mac there might not be enough space to load up the
  735. PDEF of the high-level interface.  In that desperate case the app could still
  736. print using the low-level DRVR interface, since it was very small.  I don't know
  737. of any major app that actually took advantage of this, though.
  738.  
  739. So the ImageWriter had completely separate implementations of the high- and
  740. low-level functionalities, though there was at one time a design in which the
  741. high-level PDEF did everything by calling the low-level DRVR.
  742.  
  743. The LaserWriter did use that design.  The high-level PDEF talked only to the
  744. low-level DRVR, which talked to the printer.  By the time I did the code for the
  745. LaserWriter IISC, though, it was clear that we didn't actually need a separate
  746. DRVR for anything real.  So I had to keep the DRVR, since apps still called it,
  747. but I made it do everything by calling the PDEF -- thus reversing the original
  748. design.  This simplified the implementation a *lot,* as the DRVR became a mere
  749. shell.
  750.  
  751. And a last footnote, just to show how gnarly and weird some of the old original
  752. Mac design was:  there was a strange, sick relationship between QuickDraw, the
  753. Font Manager, and the low-level print DRVR.  When drawing styled text, either QD
  754. or the FM, I forget which, would need to know some numbers to characterize
  755. things like how much to slant the image for "italic" text, how much to offset
  756. the double-strike for "bold," how much to adjust the character spacing for each
  757. of these, and so forth.  Guess how it got those numbers?  Why it *called the
  758. current print DRVR,* of course.  And the DRVR had those numbers hard-coded in
  759. it, so the printer code designer could affect the way styled text was actually
  760. imaged for that particular printer, except for the final great joke in this
  761. design, which was that most of those numbers actually had no effect whatsoever,
  762. because the code that was supposed to use them never worked.
  763.  
  764. I put all of this in the past tense, because I left the PrintShop several years
  765. ago and have no idea how much progress Tom and the other brave souls over there
  766. have made on this stuff.  And you know what, I'm happier that way...
  767.  
  768. - --
  769.  
  770. David Casseres
  771. Exclaimer: Wow!
  772.  
  773. +++++++++++++++++++++++++++
  774.  
  775. From: jcav@quads.uchicago.edu (JohnC)
  776. Organization: The Royal Society for Putting Things on Top of Other Things
  777. Date: Wed, 11 Mar 1992 16:38:15 GMT
  778.  
  779. In article <21241@goofy.Apple.COM> dowdy@apple.com (Tom Dowdy) writes:
  780. >When the Plus was released, the allocated PrGlue trap was finally
  781. >used, and the PrGlue library was changed to use the trap
  782.  
  783. Nitty-picky-osity:  _PrGlue appeared with System 4.0 (I believe) which came
  784. out a good while after the Mac Plus.  In fact, it was the system version
  785. released with the very earliest Mac SEs.  I could be slightly off on my
  786. release numbers, but I'm certain that _PrGlue is not in the 128K ROM, nor
  787. is it in System 3.2, the mainstay Mac Plus system version.
  788.  
  789. - -- 
  790. John Cavallino                  |  EMail: jcav@midway.uchicago.edu
  791. University of Chicago Hospitals |         John_Cavallino@uchfm.bsd.uchicago.edu
  792. Office of Facilities Management | USMail: 5841 S. Maryland Ave, MC 0953
  793. B0 f++ c+ g+ k s+(+) e+ h- pv   |         Chicago, IL  60637
  794.  
  795. +++++++++++++++++++++++++++
  796.  
  797. From: kent@sunfs3.Camex.COM (Kent Borg)
  798. Date: 16 Mar 92 06:23:05 GMT
  799. Organization: Camex Inc., Boston MA
  800.  
  801. OK, tell us about the Seattle font.  I have always wondered about it.
  802.  
  803.  
  804. - --
  805. Kent Borg                            internet: kent@camex.com   AOL: kent borg
  806.                                             H:(617) 776-6899  W:(617) 426-3577
  807. "Eating healthy beef is not healthful, the steer will take offense at you
  808. chewing on his flanks."      -me
  809.  
  810. +++++++++++++++++++++++++++
  811.  
  812. From: dowdy@apple.com (Tom Dowdy)
  813. Date: 30 Mar 92 16:24:20 GMT
  814. Organization: Apple Computer, Inc.
  815.  
  816. In article <1992Mar16.012305.8327@sunfs3.Camex.COM>, kent@sunfs3.Camex.COM (Kent Borg) writes:
  817. > OK, tell us about the Seattle font.  I have always wondered about it.
  818.  
  819. The Seattle font (a tale of woe, in 3 acts)
  820.  
  821. Act 1:
  822.   The Macintosh was released, and lots of folks started creating software
  823. for it.  One company in particular made lots of software right away,
  824. and they even went so far as to make their own font - for use in all
  825. of this software.  They liked the font so well (and how it printed
  826. on the ImageWriter) that they didn't give their users any way to
  827. change the font in these applications.
  828.  
  829. Act 2:
  830.   The LaserWriter was developed.  There were many many user documents
  831. in the world that were not formated using the (heretofore unavailable)
  832. LaserWriter fonts - Helvetica, Times, Courier, and Symbol.  And so
  833. the LaserWriter team decided to include a "feature" called Font Substitution.
  834. The purpose was to map the popular ImageWriter fonts (Geneva, New York,
  835. Monaco) to their closest LaserWriter fonts - thus users could get
  836. "high quality" documents without the need to change fonts.  It was
  837. a cheesy move - but users who had spent $6000 on a new printer expected
  838. existing documents to suddenly "come to life"
  839.  
  840. Act 3:
  841.   Suddently, it was realized that there was all of this
  842. software (and documents) which used a special font - with no way
  843. for users to change the font.  And so it was decided to attempt to
  844. mimic the Seattle font as a slightly larger Helvetica.  Thus 12 point
  845. Seattle mapped to 14 point Helvetica.  And so it was that the
  846. LaserWriter driver special cased for a third party font.
  847.  
  848. The End.
  849.  
  850.  Tom Dowdy                 Internet:  dowdy@apple.COM
  851.  Apple Computer MS:81KS    UUCP:      {sun,voder,amdahl,decwrl}!apple!dowdy
  852.  20525 Mariani Ave         AppleLink: DOWDY1
  853.  Cupertino, CA 95014       
  854.  "The 'Ooh-Ah' Bird is so called because it lays square eggs."
  855.  
  856. +++++++++++++++++++++++++++
  857.  
  858. From: omh@cs.brown.edu (Owen M. Hartnett)
  859. Date: 1 Apr 92 01:19:27 GMT
  860. Organization: Brown University Department of Computer Science
  861.  
  862. In article <22138@goofy.Apple.COM> dowdy@apple.com (Tom Dowdy) writes:
  863. >In article <1992Mar16.012305.8327@sunfs3.Camex.COM>, kent@sunfs3.Camex.COM (Kent Borg) writes:
  864. >> OK, tell us about the Seattle font.  I have always wondered about it.
  865. >
  866. >The Seattle font (a tale of woe, in 3 acts)
  867. >
  868. [3 acts of woe deleted]  
  869.  
  870. >
  871. >The End.
  872.  
  873. Hmmmm......
  874.  
  875. Now what major software corporation would be located near Seattle????
  876.  
  877.  
  878. Thanks, Tom, we like sordid tales like this.
  879.  
  880. - -Owen
  881.  
  882. Owen Hartnett                omh@cs.brown.edu
  883. "FAITH, n. Belief without evidence in what is told by one who speaks
  884.         without knowledge, of things without parallel."
  885.             -Ambrose Bierce - The Devil's Dictionary
  886.  
  887. ---------------------------
  888.  
  889. End of C.S.M.P. Digest
  890. **********************
  891.